package com.ytjj.qmyx.mall.model.response;

import lombok.Data;
import lombok.ToString;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 购物车响应对象
 *
 *
 * @version 1.0
 *
 */
@Data
@ToString
public class CartProductResponse implements Serializable {

    /**
     * 主键
     *
     */
    private Integer id;

    /**
     * 购物车编号
     */
    private String cartNo;

    /**
     * 商品标识
     *
     */
    private String productNo;

    /**
     * 商品名称
     *
     */
    private String productName;

    /**
     * 商品白图
     *
     */
    private String productImg;

    /**
     * 场景图
     *
     */
    private String sceneImg;

    /**
     * 缩列图
     *
     */
    private String shrinkImg;

    /**
     * 默认价格
     *
     */
    private BigDecimal price;

    /**
     * 描述
     *
     */
    private String descr;

    /**
     * 排序
     *
     */
    private Integer sort;

    /**
     * 原价
     *
     */
    private BigDecimal originalPrice;

    /**
     * 库存总量
     *
     */
    private Integer stock;

    /**
     * 评论总数
     *
     */
    private Integer commentSum;

    /**
     * 好评率
     *
     */
    private Integer goodRatio;

    /**
     * 店家id
     *
     */
    private Integer bankerId;

    /**
     * 销量
     */
    private Integer volume;

    /**
     * 销量字段
     */
    private String volumeStr;


    /**
     * 规格主键
     *
     * @mbg.generated
     */
    private Integer specId;


    /**
     * sku规格
     *
     * @mbg.generated
     */
    private String skuSpec;

    /**
     * 价格
     *
     * @mbg.generated
     */
    private BigDecimal specPrice;

    /**
     * 商品图
     *
     * @mbg.generated
     */
    private String proImg;

    private String activityType;

    /**
     * 大图标志
     */
    private Integer recImgFlag;

    /**
     * 现价
     */
    private BigDecimal curPrice;

    /**
     * 是否直接购买
     */
    private Integer isDirectBuy;

    /**
     * 活动标识：积分/红包/抵扣券
     *
     */
    private BigDecimal activityMax;

    private Integer productSum;//商品数量

    public CartProductResponse(){}

    public CartProductResponse(ProductResponse productResponse,ProductSpecResponse productSpecResponse,Integer productSum){
        BeanUtils.copyProperties(productResponse,this);
        this.specId = productSpecResponse.getId();
        this.skuSpec = productSpecResponse.getSkuSpec();
        this.specPrice = productSpecResponse.getPrice();
        this.proImg = productSpecResponse.getProImg();
        this.productSum = productSum;
    }

    public CartProductResponse(ProductActivityResponse productActivityResponse,ProductActivitySpecResponse productActivitySpecResponse){
        BeanUtils.copyProperties(productActivityResponse,this);
        this.specId = productActivitySpecResponse.getId();
        this.skuSpec = productActivitySpecResponse.getSkuSpec();
        this.specPrice = productActivitySpecResponse.getPrice();
        this.proImg = productActivitySpecResponse.getProImg();
    }

}
